package com.apes.enquiry.supplier.santouliubi.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.audit.Auditing;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.jpa.tuple.date.DateTime;
import com.apes.framework.plugin.fileserver.File;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 类描述：三头六臂采购订单
 *
 * @ClassName SantouOrder
 * @Description 描述
 * @Author wushilong
 * @Date 2023/1/4 11:27
 * @Version 1.0
 */

@Auditing
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = SantouOrder.CONST_TABLE_NAME)
public class SantouOrder {
    public static final String CONST_TABLE_NAME = "sp_santou_order";

    @Id
    @Column(name = "id", length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "三头六臂采购订单")
    @Comment("编码")
    private String id;//三头六臂单据号

    @Column(name = "order_number", length = 24)
    @Comment("单据号")
    private String orderNumber;//供应商订单

    @Column(name = "related_number", length = 24)
    @Comment("源单据号")
    private String relatedNumber;//要货单

    @Column(name = "status_name", length = 24)
    @Comment("状态描述")
    private String statusName;

    @Column(name = "status", length = 24)
    @Comment("状态")
    private String status;//5:待受理; 10:待收货;30:已完成; 40:已取消

    @Column(name = "store_id",nullable = false, length = 32)
    @Comment("门店编号")
    private String storeId;

    @Column(name = "santou_id", length = 16)
    @Comment("三头修理厂编码")
    private String santouId;

    @Column(name = "summary")
    @Comment("产品描述")
    private String summary;

    @Column(name = "reason")
    @Comment("原因")
    private String reason;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @DateTime(GenerationTime.INSERT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_date", updatable = false)
    @Comment("创建时间")
    private Date createDate;

    @Transient
    private String signVoucherURL;
}
